<?php
/**
 * Created by PhpStorm.
 * User: HuangLuSen
 * Date: 2017/12/5
 * Time: 11:23
 */

namespace app\index\controller;

use app\common\controller\Base;
/**
 * Class Home
 * @package app\index\controller
 * @author: Huang
 */
class Home extends Base
{

    /**
     *初始化系统
     */
    public function _initialize()
    {
        parent::_initialize();
        if (!is_wechat_browser()) $this->redirect('weixin/index');
        //session不存在时，不允许直接访问
        if (defined('UID')) return;
        define('UID', is_login());
        if (empty(session('user_weixin'))){
            $current_url = get_current_url();
        }
        if (!UID) $this->login($current_url);
//        $auth = new AuthRule;
//        $id_curr = $auth->get_url_id();//获取当前菜单的id
//        if (!$auth->check_auth($id_curr)) $this->error('未授权访问', url('index/index/index'));
//        //获取有权限的菜单tree
//        $menus = $auth->get_admin_menus();
//        $this->assign('menus', $menus);
    }
}